package com.cm.stock.manager.dto;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@SuppressWarnings("serial")
@Entity
@Table(name = "article",uniqueConstraints={@UniqueConstraint(columnNames={"code"})})
public class ArticleDTO implements Serializable{

	@Id
	@Column(name = "ID", nullable = false)
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;
	@Column(length=25, nullable=false)
	private String code	;
	private String designation;
	private double prixEnStock;
	private double prixDeVente;
	private int quantiteEnStock;
	private int seuilAlerte;
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "groupe_Id",nullable=true)
	private GroupeDTO groupe;
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getDesignation() {
		return designation;
	}
	public void setDesignation(String designation) {
		this.designation = designation;
	}
	public double getPrixEnStock() {
		return prixEnStock;
	}
	public void setPrixEnStock(double prixEnStock) {
		this.prixEnStock = prixEnStock;
	}
	public double getPrixDeVente() {
		return prixDeVente;
	}
	public void setPrixDeVente(double prixDeVentre) {
		this.prixDeVente = prixDeVentre;
	}
	public int getQuantiteEnStock() {
		return quantiteEnStock;
	}
	public void setQuantiteEnStock(int quantiteEnStock) {
		this.quantiteEnStock = quantiteEnStock;
	}
	public int getSeuilAlerte() {
		return seuilAlerte;
	}
	public void setSeuilAlerte(int seuilAlerte) {
		this.seuilAlerte = seuilAlerte;
	}
	
	public GroupeDTO getGroupe() {
		return groupe;
	}
	public void setGroupe(GroupeDTO groupe) {
		this.groupe = groupe;
	}
	public ArticleDTO(String code, String designation, double prixEnStock,
			double prixDeVente, int quantiteEnStock, int seuilAlerte) {
		super();
		this.code = code;
		this.designation = designation;
		this.prixEnStock = prixEnStock;
		this.prixDeVente = prixDeVente;
		this.quantiteEnStock = quantiteEnStock;
		this.seuilAlerte = seuilAlerte;
	}
	
	public ArticleDTO(String code, String designation, double prixEnStock,
			double prixDeVente, int quantiteEnStock, int seuilAlerte,
			GroupeDTO groupe) {
		super();
		this.code = code;
		this.designation = designation;
		this.prixEnStock = prixEnStock;
		this.prixDeVente = prixDeVente;
		this.quantiteEnStock = quantiteEnStock;
		this.seuilAlerte = seuilAlerte;
		this.groupe = groupe;
	}
	public ArticleDTO() {
		super();		
	}
	
	

}
